// pages/app/activities/activityInfo/activityInfo.js
const app = getApp();
var host = app.globalData.host;
var utils = app.globalData.utils;
var self = null;

Page({
  data: {
    themeColor: '',
    themeColor2: '',
    themeColor3: '',
    defaultColor: '',
    borderColor: '',
    activityId: null,
    info: ''
  },
  onLoad: function (options) {
    self = this;
    self.getStyle();
    self.setData({
      activityId: options.id
    })
    self.init();
  },
  getStyle() {
    self.setData({
      themeColor: app.globalData.themeColor,
      themeColor2: app.globalData.themeColor2,
      themeColor3: app.globalData.themeColor3,
      defaultColor: app.globalData.defaultColor,
      borderColor: app.globalData.borderColor
    })
  },
  init() {
    var url = host + '/lx/mini/activity/info';
    var params = {
      id: self.data.activityId
    };
    var success = function (res) {
      self.setData({
        info: res.info
      })
    }
    var fail = function () { };
    var complete = function () { };
    utils.request(url, params, success, fail, complete);
  },
  join(e) {
    var url = host + '/lx/mini/activity/submit';
    var params = {
      id: self.data.activityId
    };
    var success = function (res) {
      self.init();
    }
    var fail = function () { };
    var complete = function () { };
    utils.request(url, params, success, fail, complete);
  },
  enter(e) {

  }
})